package com.huike.controller;

import com.huike.po.SystemCustom;
import com.huike.po.p2pMessage;
import com.huike.pojo.BatchSendSysMsg;
import com.huike.pojo.Response;
import com.huike.service.SysCustomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.util.List;

@Controller

/**
 * 系统通知相关的请求访问
 */

@RequestMapping("/sysCustom")
public class SysCustomController {
    @Autowired
    SysCustomService sysCustomService;
    @Autowired
    public Response response;

    @RequestMapping(value = "/markIsRead" )
    @ResponseBody
    public Response markSysCustomIsRead(String account, HttpSession session) {
        if(sysCustomService.markSysCustomIsRead(account))
            response.setCode("200");
        else
            response.setCode("500");
        response.setContent("");
        return response;
    }

    @RequestMapping(value = "/deleteSysCustom" )
    @ResponseBody
    public Response deleteSysCustom(String account) {
        if(sysCustomService.deleteSysCustom(account))
            response.setCode("200");
        else
            response.setCode("500");
        response.setContent("");
        return response;
    }

    @RequestMapping(value = "/batchSend" )
    @ResponseBody
    public Response batchSendSysCustom(@RequestBody BatchSendSysMsg msg) {
        if(sysCustomService.batchSendSysMsg(msg))
            response.setCode("200");
        else
            response.setCode("500");
        response.setContent("");
        return response;
    }


}
